function sureaddNotebook(){

    //console.log("add  book ")
    var bookName = $("#input_notebook").val().trim();
    console.log(bookName)
    $.ajax({
        url: base_url + "/notebook/add.do",
        type: 'post',
        data: {"userId":userId,"bookName":bookName},
        dataType: 'json',
        success:function(result){
            // console.log(result);
            //关闭对话框
            closeWindow();
            //添加一个li
            var bookId = result.data
            //console.log(bookId)
            createBookLi(bookName,bookId)

        },
        error:function(){
            alert("add notebook error")
        }

    })


}


function createBookLi(bookName,bookId){
    var s_li  ='<li class="online">'
    s_li +='<a>'
    s_li +='<i class="fa fa-book" title="online" rel="tooltip-bottom">'
    s_li +='</i>' + bookName
    s_li +='</a>'
    s_li +='</li>'
    var $li = $(s_li);
    $li.data("bookId",bookId);
    //将li添加到ul中
    $("#book_list").append($li);
}
function loadUserBooks(){
    $.ajax({
        url: base_url + "/notebook/loadbooks.do",
        type: 'post',
        data: {"userId":userId},
        dataType: 'json',
        success:function(result){
            //console.log(result)
            var books = result.data;
            for(var i=0;i<books.length;i++){
                var bookName = books[i].cn_notebook_name;
                var bookId = books[i].cn_notebook_id;
                //拼接一个li
                createBookLi(bookName,bookId);
            }
        },
        error:function(){
            alert("加载笔记列表失败")
        }
    })
}